<?php 
require('../common/mysql.php');
setcookie('admin', 1, time() + (86400 * 30), "/");
require('../common/isAdmin.php');
?>
<?php
// 创建Sql类的实例  
$db = new Sql();  

$Alluser = $db->getAll("SELECT * FROM `user`");

// 关闭数据库连接（如果需要的话，通常PHP脚本结束时连接会自动关闭）  
$db->close();  


?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>Hadi.后台管理</title>
		<style>
		body{
			background-color:#3CB378;
		}
		.container{
			background-color:white;
			border-radius:10px;
			padding:3px;
			margin:5px;
			text-align:center;
		}
		.btndiv button{
			padding:6px;
			margin:3px;
			border:none;
			border-radius:3px;
		}
		.userDIV{
			padding:5px;
		}
		</style>
	</head>
	<body>
		<div class="container btndiv">
			<button onclick="window.location.href='/index.php?all=1'">查看全部账单数据</button>
			<button onclick="window.location.href='/admin/savecate.php'">查看分类申请</button>
		</div>
		<div class="container">
			<span style="font-size:20px;">全部用户</span>
			<?php for($i=0;$i<count($Alluser);$i++){?>
				<div class="userDIV" onclick="window.location.href='/admin/setuser.php?u=<?php echo $Alluser[$i]["username"];?>'">
				用户: <?php echo $Alluser[$i]["username"];?>
				</div>
			<?php }?>
		</div>
		<div class="container">
		<p>点击用户可以查看/编辑用户的一切信息。</p>
		</div>
	</body>
</html>
